package com.java.exer1;

public class AccountTest_1 {
    private int id;
    private double balance;
    private double annualInterestRate;

    public AccountTest_1(int id, double balance, double annualInterestRate) {
        this.id = id;
        this.balance = balance;
        this.annualInterestRate = annualInterestRate;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }

    public void setAnnualInterestRate(double annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }

    public double getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void withdraw(double amount) {    //取钱
        if (amount > balance) {
            System.out.println("你的余额不足");
        } else {
            balance -= amount;
            System.out.println("取出余额：" + amount + "余额为" + balance);
        }
    }

    public void deposit(double amount) {
        if (amount < 0) {
            System.out.println("输入有误");
        } else {
            balance += amount;
            System.out.println("成功存入，你的余额为：" + balance);
        }
    }
}
